package com.chaobl.goods.shop.controller;


import com.chaobl.goods.shop.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2020-04-05
 */
@RestController
@RequestMapping("/shop/shop")
public class ShopController {
    @Autowired
    IShopService shopService;

    @Resource
    ValueOperations<String, Object> valueOperations;


    @GetMapping("/test")
    public Object test() {
        return shopService.list();
    }

    @GetMapping("/test2")
    public Object test2() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", "老刘");
        map.put("mobile", "18610348075");

        valueOperations.set("001", map);

        return valueOperations.get("001");
    }

}
